package com.example.ivory.accountbook.Activity;

import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.view.animation.Animation;
import android.view.animation.AnimationSet;
import android.view.animation.RotateAnimation;

import com.example.ivory.accountbook.R;
import com.example.ivory.accountbook.uilt.RoundImageView;

public class budget extends AppCompatActivity {

    private RoundImageView roundImageViewCenter;
    private RoundImageView roundImageViewLeft;
    private RoundImageView roundImageViewRight;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_budget);
        roundImageViewCenter=(RoundImageView) findViewById(R.id.center) ;

        View.OnClickListener onClickListenerCenter=new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                AnimationSet animationSet=new AnimationSet(true);
                RotateAnimation rotateAnimation= new RotateAnimation(-40,40, Animation.RELATIVE_TO_SELF,0.5f,Animation.RELATIVE_TO_SELF,0.5f);
                rotateAnimation.setDuration(2000);
                animationSet.addAnimation(rotateAnimation);
                roundImageViewCenter.startAnimation(animationSet);
            }
        };
        roundImageViewCenter.setOnClickListener(onClickListenerCenter);
        roundImageViewLeft=(RoundImageView) findViewById(R.id.left) ;

        View.OnClickListener onClickListenerLeft=new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                AnimationSet animationSet=new AnimationSet(true);
                RotateAnimation rotateAnimation= new RotateAnimation(-40,40, Animation.RELATIVE_TO_SELF,0.5f,Animation.RELATIVE_TO_SELF,0.5f);
                rotateAnimation.setDuration(1000);
                animationSet.addAnimation(rotateAnimation);
                roundImageViewLeft.startAnimation(animationSet);
            }
        };
        roundImageViewLeft.setOnClickListener(onClickListenerLeft);
        roundImageViewRight=(RoundImageView) findViewById(R.id.right) ;

        View.OnClickListener onClickListenerRight=new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                AnimationSet animationSet=new AnimationSet(true);
                RotateAnimation rotateAnimation= new RotateAnimation(-40,40, Animation.RELATIVE_TO_SELF,0.5f,Animation.RELATIVE_TO_SELF,0.5f);
                rotateAnimation.setDuration(1000);
                animationSet.addAnimation(rotateAnimation);
                roundImageViewRight.startAnimation(animationSet);
            }
        };
        roundImageViewRight.setOnClickListener(onClickListenerRight);

    }
}
